package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.ReaderVideoBean;
import com.xuxin.baby.contract.TeachContract;
import com.xuxin.baby.model.TeachModel;

/**
 * Created by xu_xin
 * Created on 2020/11/20 0020
 * 精婴早教
 */
public class TeachPresenter implements TeachContract.Presenter {
    private final TeachModel model;
    private final TeachContract.View view;

    public TeachPresenter(TeachContract.View view) {
        this.view = view;
        model = new TeachModel();
    }

    @Override
    public void getVideo(String tenantId, String token, String categoryId) {
        if (null != model) {
            model.getVideo(this, tenantId, token, categoryId);
        }
    }

    @Override
    public void onSuccessVideo(ReaderVideoBean readerVideoBean) {
        if (null != view) {
            view.onSuccessVideo(readerVideoBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}